package com.ujiuye.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @RequestMapping("/getuser")
    @PreAuthorize("hasAnyRole('user')")
    public String getUser(){
        return "this is user";
    }

    @RequestMapping("/getadmin")
    @PreAuthorize("hasAnyRole('admin')")
    public String getAdmin(){
        return "this is admin";
    }
}
